import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class GpsILoveYou {
	
	public static void main(String[] args) throws Throwable{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		while(true){
			int n=Integer.parseInt(br.readLine());
			StringTokenizer st;
			int gps[][]=new int[n][n];
			for (int i = 0; i < n; i++) {
				st=new StringTokenizer(br.readLine());
				for (int j = 0; j < gps.length; j++) {
					gps[i][j]=Integer.parseInt(st.nextToken());
				}
			}
			st=new StringTokenizer(br.readLine());
			int m=Integer.parseInt(st.nextToken());
			
			int ruta[]=new int[m];
			
			for (int i = 0; i < m; i++) {
				ruta[i]=Integer.parseInt(st.nextToken());
			}
			
			
			
		}
	}

}
